Skip to content

Fix #6988: add test #7009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 16, 2020
Merged

Fix #6988: add test #7009

merged 5 commits into from
Jan 16, 2020

Conversation

liufengyun
Copy link
Contributor

Fix #6988: add test

Literal(Constant(value)).seal.asInstanceOf[Expr[String]]
val paramss = enclosingParamList(rootContext.owner)
val firstArg = paramss.flatten.head
val ref = Select.unique(This(enclosingCls), firstArg.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a fix, since my report is about Ref(...) not working.

Copy link
Contributor Author

@liufengyun liufengyun Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is not with Ref, but about compiler internals: at the code place & pickling phase where we refer to the constructor param symbol, it's simply not accessible.

After the compiler phases that actually create primary constructors, the code might work, but it's far after pickling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have an assertion inside Ref to prevent the creation of an inconsistent ref.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's practical to add checks in Ref --- it works as expected, it's where we put the tree result in pickling crash.

@odersky
Copy link
Contributor

odersky commented Dec 12, 2019

@liufengyun @nicolasstucki Can we resolve this before the release?

@liufengyun
Copy link
Contributor Author

Just checked, with the original code, -Ycheck:all can catch the error:

java.lang.AssertionError: assertion failed: undefined symbol value p1 at line 25 while compiling tests/neg/6988/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: undefined symbol value p1 at line 25
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.transform.TreeChecker$Checker.assertDefined(TreeChecker.scala:204)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedIdent(TreeChecker.scala:339)

@nicolasstucki
Copy link
Contributor

@liufengyun there is still some syntax to update

@nicolasstucki nicolasstucki merged commit 4bd9400 into scala:master Jan 16, 2020
@nicolasstucki nicolasstucki deleted the fix-6988 branch January 16, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unresolved symbols: value p1(line 15) when pickling
4 participants